import dayjs from 'dayjs';
// 格式化日期
const formatDate = (date) => {
  if (!date) {
    return '';
  }
  return dayjs(date).format('YYYY-MM-DD HH:mm:ss');
};
export const baseColumns = [
  {
    title: '排序',
    dataIndex: 'sort',
    width: 80,
  },
  {
    title: '菜单名称',
    dataIndex: 'title',
    width: 180,
  },
  {
    title: '图标',
    dataIndex: 'icon',
    width: 100,
    customRender: ({ text }) => {
      return <y-icon icon={text} />;
    },
  },

  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 180,
    customRender: ({ text }) => formatDate(text),
  },
  {
    title: '组件',
    dataIndex: 'component',
    width: 300,
  },

  {
    title: '菜单路径',
    dataIndex: 'path',
    width: 120,
  },
  {
    title: '菜单类型',
    dataIndex: 'type',
    width: 100,
  },
];
